//
//  CelltestTableViewCell.swift
//  SwiftTest
//
//  Created by 齐凯 on 2019/2/15.
//  Copyright © 2019年 QiKai. All rights reserved.
//

import UIKit

class CelltestTableViewCell: UITableViewCell {
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    //实例化方法
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    class func tableviewBack(tableV:UITableView) -> CelltestTableViewCell {
        let cellid = "celltest"
        var cell:CelltestTableViewCell!
        
        if let cellBeforWarrp = tableV.dequeueReusableCell(withIdentifier: cellid) as? CelltestTableViewCell{
            cell = cellBeforWarrp
        }else{
            cell = CelltestTableViewCell.init(style: UITableViewCell.CellStyle.default, reuseIdentifier: cellid)
        }
        cell.selectionStyle = UITableViewCell.SelectionStyle.none
        cell.backgroundColor = UIColor.red
        return cell
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.creatUI()
    }

    
    func creatUI(){
        
        let lab = UILabel()
        self.contentView.addSubview(lab)
        lab.font = UIFont.systemFont(ofSize: 14)
        lab.text = "swift 学习";
        lab.snp.makeConstraints { (make) in
            make.size.equalTo(CGSize(width: 100, height: 20));
            make.centerY.equalToSuperview()
            make.left.equalTo(self.contentView).offset(20)
        }
    }
    
}
